package gmu.drr.entity;

import java.util.ArrayList;


public abstract class UserGroupRelModel {

	private int userInd;
	private long userNo;
	private User user;
	private boolean isActive;
	protected static ArrayList<UserGroupRelModel> allActive = null;
	
	public boolean isActive() {
		return isActive;
	}

	public void setActive(boolean isActive) {
		if( isActive != this.isActive ) {
			if( isActive ) allActive.add(this.userInd, this);
			else allActive.remove(this.userInd);
		}
		this.isActive = isActive;
	}


	public int getUserInd() {
		return userInd;
	}

	public void setUserInd(int userInd) {
		this.userInd = userInd;
	}

	public long getUserNo() {
		return userNo;
	}

	public void setUserNo(long userNo) {
		this.userNo = userNo;
	}


	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
		this.userNo = user.getUserNo();
		this.userInd = user.getContextInd();
	}

	/* end getters and setters */
	
	/** subclass responsibility */
	abstract public User getInverseUser( UserGroup group );

	public UserGroupRelModel() {
		super();
		if(allActive == null) allActive = new ArrayList<UserGroupRelModel>();
	}
}
